<extend name="work/base"/>
<block name="content">

    <div class="pull-left">
        <div class="layui-inline">
            <button class="layui-btn layui-btn-normal  ajax-form" data-url="{:url('add')}"><i class="layui-icon">&#xe61f;</i> 新增</button>
        </div>
    </div>

    <table class="layui-table text-center" id="list" lay-filter="list" list-url="{:url('list')}"
           del-url="{:url('delete')}"
          ></table>
</block>

<block name="script">
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"> <i class="fa fa-trash-o"></i> 删除</a>
    </script>

    <script type="text/javascript">
        layui.use(['element', 'table', 'form'], function () {
            var table = layui.table
                , form = layui.form;
            table.render({
                elem: '#list'
                , url: "{:Url('list')}"
                , page: true
                , loading: true
                ,limit:20
                , cols: [[
                   {field: 'd_time',width: 180, title: '节假日期'}
                    , {field: 'info', title: '节假日名称'}
                    ,{fixed: 'right', width:80,title:'操作', toolbar:'#barDemo'}
                ]]
            });
            form.on('select(uid)', function (data) {
                table.reload('list', {
                    url: "{:Url('list')}"
                    , page: {
                        curr: 1
                    }
                    , where: {
                        uid: data.value
                    }
                });
                return false;
            });
        });
    </script>
</block>
